<?php
class ControllerToolErrorLog extends AdminController {

	public function index() {
		$this->document->setTitle($this->_['heading_title']);

		$file = DIR_LOGS . C('config_error_filename');
		if (file_exists($file)) {
			$this->data['log'] = file_get_contents($file, FILE_USE_INCLUDE_PATH, null);
		} else {
			$this->data['log'] = '';
		}

		$this->display('tool/error_log.tpl');
	}

	public function clear() {

		$file = DIR_LOGS . C('config_error_filename');
		$handle = fopen($file, 'w+');
		fclose($handle);

		$this->session->set_flashdata('success', $this->_['text_success']);
		$this->redirect(UA('tool/error_log'));
	}
}
?>